#include "AboutScene.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
#include "WelcomeScene.h"

using namespace cocos2d::ui;

bool AboutScene::init() {
	if (!Layer::init()) {
		return false;
	}
	auto node = CSLoader::createNode("AboutScene.csb");
	this->addChild(node);
	auto back_btn = dynamic_cast<Button*>(node->getChildByName("back_btn"));
	if (back_btn == nullptr) {
		log("back button is null!");
	}
	else {
		back_btn->addTouchEventListener([](Ref* ref, Widget::TouchEventType type) {
			if (type == Widget::TouchEventType::BEGAN) {
				Director::getInstance()->replaceScene(TransitionRotoZoom::create(0.3f, WelcomeScene::createScene()));
			}
		});
	}

	return true;
}

Scene* AboutScene::createScene() {
	auto scene = Scene::create();
	auto layer = AboutScene::create();
	scene->addChild(layer);
	return scene;
}